clear all

// SET MACROS
global Input  "Y:/limited/Michigan_CTE/funding_change/data_final"
global Output "Y:/limited/Michigan_CTE/funding_change/output/figures"

qui include "Y:/limited/Michigan_CTE/funding_change/code/analyze/figures/00_colors.do"

local demographics "female black hisp another_race sped lep econdis"
local academics "test_avg_g8 test_avg_sq_g8 test_avg_g8_imp attendance_g8 attendance_g8_imp"

// LOAD DATA
use $Input/compiled_student_analysis_data.dta

keep if grad_year >= 2012
gen post = grad_year >= 2015

gen all = 1

* number for text
reg max_courses `demographics' `academics' post, cluster(school) a(school) 
reg max_courses `demographics' `academics' post if max_courses>0, cluster(school) a(school) 


tab max_courses post
count if post == 0
local n0 = `r(N)'
count if post == 1 
local n1 = `r(N)'

gcollapse (sum) all, by(max_courses post)
replace all = all / `n0' if post == 0
replace all = all / `n1' if post == 1

reshape wide all, i(max_courses) j(post)

// DRAW GRAPH
graph bar all0 all1, over(max_courses, relabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6+")) ///
  bar(1, color("$c1")) bar(2, color("$c2")) ///
  ytitle("Share of Students" " ") ///
  ylabel(0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4" 0.5 "0.5", angle(0) glc(gs13) glw(vthin) glp(shortdash) gmax) ///
  b1title(" " "Number of Courses Completed in Main CTE Program") ///
  legend(order(1 "Before Funding Formula Change" 2 "After Change") symxsize(7) size(medium) region(lstyle(none))) ///
  graphregion(color(white)) bgcolor(white) ///
  xsize(7.5) ysize(3.5) ///
	 scheme(s2color)


// EXPORT GRAPH

graph save  $Output/03_courses_before_after.gph, replace

*graph export $Output/courses_before_after.png, replace
